//===- KeyEvent.h ---------------------------------------------------------===//
//
// Copyright (C), 2012-
// Luba Tang <lubatang@gmail.com>
//===----------------------------------------------------------------------===//
#ifndef LUBA_KEY_EVENT_H
#define LUBA_KEY_EVENT_H
#include <Events/Event.h>

#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

namespace luba {

class KeyEvent : public Event
{
public:
  enum Key {
    KeyEscape        = 0x1000,
    KeyTab           = 0x1001,
    KeyBackTab       = 0x1002,
    KeyBackSpace     = 0x1003,
    KeyReturn        = 0x1004,
    KeyEnter         = 0x1005,
    KeyInsert        = 0x1006,
    KeyDelete        = 0x1007,
    KeyPause         = 0x1008,
    KeyPrint         = 0x1009,
    KeySysReq        = 0x100a,
    KeyClear         = 0x100b,
    KeyHome          = 0x1010,
    KeyEnd           = 0x1011,
    KeyPageUp        = 0x1016,
    KeyPageDown      = 0x1017,
    KeyShift         = 0x1020,
    KeyControl       = 0x1021,
    KeyMeta          = 0x1022,
    KeyAlt           = 0x1023,
    KeyCapsLock      = 0x1024,
    KeyNumLock       = 0x1025,
    KeyScrollLock    = 0x1026,
    KeyF1            = 0x1030,
    KeyF2            = 0x1031,
    KeyF3            = 0x1032,
    KeyF4            = 0x1033,
    KeyF5            = 0x1034,
    KeyF6            = 0x1035,
    KeyF7            = 0x1036,
    KeyF8            = 0x1037,
    KeyF9            = 0x1038,
    KeyF10           = 0x1039,
    KeyF11           = 0x103a,
    KeyF12           = 0x103b,
    KeyF13           = 0x103c,
    KeyF14           = 0x103d,
    KeyF15           = 0x103e,
    KeyF16           = 0x103f,
    KeyF17           = 0x1040,
    KeyF18           = 0x1041,
    KeyF19           = 0x1042,
    KeyF20           = 0x1043,
    KeyF21           = 0x1044,
    KeyF22           = 0x1045,
    KeyF23           = 0x1046,
    KeyF24           = 0x1047,
    KeyF25           = 0x1048,
    KeyF26           = 0x1049,
    KeyF27           = 0x104a,
    KeyF28           = 0x104b,
    KeyF29           = 0x104c,
    KeyF30           = 0x104d,
    KeyF31           = 0x104e,
    KeyF32           = 0x104f,
    KeyF33           = 0x1050,
    KeyF34           = 0x1051,
    KeyF35           = 0x1052,
    KeySuperL        = 0x1053,
    KeySuperR        = 0x1054,
    KeyMenu          = 0x1055,
    KeyHyperL        = 0x1056,
    KeyHyperR        = 0x1057,
    KeyHelp          = 0x1058,
    KeyDirectionL    = 0x1059,
    KeyDirectionR    = 0x1060,
    KeySpace         = 0x20,
    KeyExclam        = 0x21,
    KeyQuoteDbl      = 0x22,
    KeyNumberSign    = 0x23,
    KeyDollar        = 0x24,
    KeyPercent       = 0x25,
    KeyAmpersand     = 0x26,
    KeyApostrophe    = 0x27,
    KeyParenLeft     = 0x28,
    KeyParenRight    = 0x29,
    KeyAsterisk      = 0x2a,
    KeyPlus          = 0x2b,
    KeyComma         = 0x2c,
    KeyMinus         = 0x2d,
    KeyPeriod        = 0x2e,
    KeySlash         = 0x2f,
    Key0             = 0x30,
    Key1             = 0x31,
    Key2             = 0x32,
    Key3             = 0x33,
    Key4             = 0x34,
    Key5             = 0x35,
    Key6             = 0x36,
    Key7             = 0x37,
    Key8             = 0x38,
    Key9             = 0x39,
    KeyColon         = 0x3a,
    KeySemicolon     = 0x3b,
    KeyLess          = 0x3c,
    KeyEqual         = 0x3d,
    KeyGreater       = 0x3e,
    KeyQuestion      = 0x3f,
    KeyAt            = 0x40,
    KeyA             = 0x41,
    KeyB             = 0x42,
    KeyC             = 0x43,
    KeyD             = 0x44,
    KeyE             = 0x45,
    KeyF             = 0x46,
    KeyG             = 0x47,
    KeyH             = 0x48,
    KeyI             = 0x49,
    KeyJ             = 0x4a,
    KeyK             = 0x4b,
    KeyL             = 0x4c,
    KeyM             = 0x4d,
    KeyN             = 0x4e,
    KeyO             = 0x4f,
    KeyP             = 0x50,
    KeyQ             = 0x51,
    KeyR             = 0x52,
    KeyS             = 0x53,
    KeyT             = 0x54,
    KeyU             = 0x55,
    KeyV             = 0x56,
    KeyW             = 0x57,
    KeyX             = 0x58,
    KeyY             = 0x59,
    KeyZ             = 0x5a,
    KeyBracketLeft   = 0x5b,
    KeyBackslash     = 0x5c,
    KeyBracketRight  = 0x5d,
    KeyAsciiCircum   = 0x5e,
    KeyUnderscore    = 0x5f,
    KeyQuoteLeft     = 0x60,
    Keya             = 0x61,
    Keyb             = 0x62,
    Keyc             = 0x63,
    Keyd             = 0x64,
    Keye             = 0x65,
    Keyf             = 0x66,
    Keyg             = 0x67,
    Keyh             = 0x68,
    Keyi             = 0x69,
    Keyj             = 0x6a,
    Keyk             = 0x6b,
    Keyl             = 0x6c,
    Keym             = 0x6d,
    Keyn             = 0x6e,
    Keyo             = 0x6f,
    Keyp             = 0x70,
    Keyq             = 0x71,
    Keyr             = 0x72,
    Keys             = 0x73,
    Keyt             = 0x74,
    Keyu             = 0x75,
    Keyv             = 0x76,
    Keyw             = 0x77,
    Keyx             = 0x78,
    Keyy             = 0x79,
    Keyz             = 0x7a,
    KeyLeft          = GLUT_KEY_LEFT,
    KeyUp            = GLUT_KEY_UP,
    KeyRight         = GLUT_KEY_RIGHT,
    KeyDown          = GLUT_KEY_DOWN,
    KeyBraceLeft     = 0x7b,
    KeyBar           = 0x7c,
    KeyBraceRight    = 0x7d,
    KeyAsciiTilde    = 0x7e,
    Keynobreakspace  = 0x0a0,
    Keyexclamdown    = 0x0a1,
    Keyunknown       = 0xffff
  };

public:
  KeyEvent();
  ~KeyEvent();

  void setKey(int pKey);
  int key() const { return m_Key; }

private:
  int m_Key;
};

} // namespace of luba

#endif

